Skip to content

fix(tlsf): forward realloc to tlsf#124

Merged
zeenix merged 1 commit intorust-embedded:masterfrom
Conaclos:conaclos/tlsf-forward-realloc
Mar 4, 2026
Merged

fix(tlsf): forward realloc to tlsf#124
zeenix merged 1 commit intorust-embedded:masterfrom
Conaclos:conaclos/tlsf-forward-realloc

Conversation

@Conaclos
Copy link
Contributor

Hi!

I am working in an embedded context that shipped some shims for C realloc. The shim simply delegates the allocation/reallocation to the global Rust allocator.
It passed a dummy layout to alloc::realloc and alloc::dealloc, assuming that the global allocator ignore them and retrieve the original layout on its own.
I am currently using the tlsf allocator ad global allocator.
So I discovered a bug where the current embedded-alloc implementation doesn't ignore the dummy layout in the case of reallocations because it used the default implementation of the Rust library.
This is a bug: realloc should be forwarded to the underlying rlsf crate.
This PR fixes this bug.

@Conaclos Conaclos requested a review from a team as a code owner February 25, 2026 09:39
Copy link
Contributor

@zeenix zeenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise.

@Conaclos Conaclos requested a review from zeenix March 3, 2026 12:21
@Conaclos Conaclos requested a review from zeenix March 3, 2026 15:31
@Conaclos Conaclos requested a review from zeenix March 3, 2026 17:42
@zeenix zeenix added this pull request to the merge queue Mar 4, 2026
@zeenix zeenix removed this pull request from the merge queue due to a manual request Mar 4, 2026
@zeenix
Copy link
Contributor

zeenix commented Mar 4, 2026

@Conaclos Since there is no option to squash merge, could you please squash all your commits and force push to this branch? Thanks.

@Conaclos Conaclos force-pushed the conaclos/tlsf-forward-realloc branch from f072c3c to f26e5c4 Compare March 4, 2026 12:40
@Conaclos Conaclos force-pushed the conaclos/tlsf-forward-realloc branch from f26e5c4 to 1982836 Compare March 4, 2026 12:42
@Conaclos
Copy link
Contributor Author

Conaclos commented Mar 4, 2026

Rebased and squashed.

@zeenix zeenix added this pull request to the merge queue Mar 4, 2026
Merged via the queue into rust-embedded:master with commit 13c18de Mar 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants